﻿@model IEnumerable<CTM.Web.Models.View.Comment.CommentViewModel>
@using CTM.Web.Utils

@foreach (var comment in Model)
{
    if (comment.IsDeleted)
    {
        <blockquote style="text-decoration: line-through; font-style: italic; color: silver;">
            <div class="imgCommentLogo">
                <a href="@Url.Action("Index", "Home", new { id = comment.ModifiedUser.Id })">
                    <img src="@comment.ModifiedUser.Avatar" width="48" height="48" alt="" class="user-avatar">
                </a>
            </div>
            This comment was deleted by @comment.ModifiedUser.DisplayName
        </blockquote>
    }
    else
    {
        <blockquote>
            <div class="imgCommentLogo">
                <a href="@Url.Action("Index", "Home", new { id = comment.CreatedUser.Id })">
                    <img src="@comment.CreatedUser.Avatar" width="48" height="48" alt="" class="user-avatar">
                </a>
            </div>
            @Html.Raw(comment.Content)
            @if (comment.CreatedBy == GlobalVariables.CurrentUser.Id)
            {
                <button type="button" class="btn-link rbvh-btn-remove-comment" data-toggle="modal" data-target="#DeleteCommentModal" data-url='@Url.Action("Delete", "Comment", new { id = comment.Id })'>
                    <span class="glyphicon glyphicon-trash"></span>
                </button>
            }            
            <div class="attribution">&mdash;@comment.CreatedOn.ToString("dd-MMM-yyyy")</div>
        </blockquote>
    }

}
